#include <stdint.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h> 
#include <stdlib.h>
#include <assert.h>
#include "app_platform/cntl_info.h"
#include "storageao.h"


using namespace erp::storage::ao;

CPP_SELF_DEFINE_START
/**
*  请在这里增加自定义的成员变量和函数及其他内容，否则无法合并代码
**/
#include "erp/storage/to/stockddoconvpo.h"
#include "erp/storage/to/stockfilterddoconvpo.h"
#include "erp/comm/erp_errno_define.h"
#include "erp/comm/erp_yun_define.h"
#include "erp/comm/erp_macro_define.h"
#include "erp/storage/dao/storagedao_stub4app_allinone.h"
#include "erp/storage/po/stockfilterpo_storage.h"
#include "erp/storage/po/stockpo_storage.h"



using namespace erp::comm;
using namespace erp::storage::dao;
using namespace erp::storage::to;
using namespace erp::storage::po;
using namespace c2cent::library::wwlog;
using namespace c2cent::library::wtimeelf;
using namespace erp::yun::comm;


CPP_SELF_DEFINE_END

/**
 *构建函数
 */
CStorageAo::CStorageAo(enum DeployMethod method)
{

}

/**
 *析构函数
 */
CStorageAo::~CStorageAo()
{

}


/**
 *每一次服务请求时，container都会调用此方法来清空数据
 */
void  CStorageAo::Reset()
{
	m_dwOperatorUin=0;
	m_dwSceneId=0;
	m_strMachineKey="";
	m_strSource="";

}


int  CStorageAo::Initialize(IUserDefineCntl* pCntl)
{
	int iRet = 0;

    uint32_t dwLogSwitch=WLOG_OPEN|WLOG_KEY_OPEN|WLOG_ERR_OPEN;

    uint32_t dwCanLogRemote = 0;
    std::string strLogModule="ao_storage";
    std::set<uint32_t> setUseCache;

    std::cout<<"File:"<<__FILE__<<" Complie Date: "<<__DATE__<<" "<<__TIME__<<std::endl;

    GetUintConfig(LogSwitch);
    GetStringConfig(LogModule);
    GetUintConfig(CanLogRemote);

    // 初始化日志
    if( C2C_WWLOG->QuickInitForAPP2(strLogModule.c_str(),B2B2CWW_LOG_APP_FILE_PATH, dwCanLogRemote, dwLogSwitch)!= 0)
    {
        std::cerr << "C2C_WWLOG->QuickInitForAPP2 Failed" << std::endl;
        return -1;
    }
    C2C_WW_LOG("C2C_WWLOG->QuickInitForAPP2 OK!");

	return iRet;
}



/**
 *
 *  写入仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param StockPo StockInfo: 仓库信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param uint64_t StockSysNo: 返回添加成功的SysNo  	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::AddStock(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::po::CStockPo& oStockInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				uint64_t& ddwStockSysNo
	)
{
	uint32_t iRetCode = 0;
	//TODO:业务代码
	m_strMachineKey=strMachineKey;
	m_strSource=strSource;
	m_dwSceneId=dwSceneId;
	m_dwOperatorUin=rCntlInfo.getOperatorUin();


    C2C_WW_LOG("AddStock %s OpUin:%u MachineKey:%s Source:%s SceneId:%u", __FUNCTION__,
    		m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId);
    //打印性能日志的同时进行接口的itil上报

    iRetCode=CheckCommPara();
	if(iRetCode!=0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	iRetCode=CheckStockInfo(oStockInfo);
	if(iRetCode!=0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	CStorageDaoStub4App oStub;
	erp::storage::ddo::CStockDdo oStockddo;
	erp::storage::ddo::CStockDdo oStockddoBack;
	erp::storage::ddo::CStockFilterDdo oStockFilterDdo;
	std::map<uint32_t,erp::storage::ddo::CStockDdo>  mapStocksDdo;
	std::set<uint32_t> idList;

	CStockPoConvCStockDdo::Conv_CStockPo_To_CStockDdo(oStockInfo,oStockddo);

	iRetCode=oStub.AddStock(rCntlInfo,m_strMachineKey,m_strSource,m_dwSceneId,dwOption,oStockddo,
			strInReserve,strErrmsg,strOutReserve,ddwStockSysNo);

	if(iRetCode!=0)
	{
		C2C_WW_LOG_ERR(iRetCode,"AddStock Failed! ID:%ld SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
				oStockInfo.GetStockSysNo(),m_dwSceneId,m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId,strErrmsg.c_str());
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	return iRetCode;
}

/**
 *
 *  逻辑删除仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param Set FStockSysNo: 需删除的仓库ID，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map errorCode: 删除失败的错误码 	[out]
 *@param Map errorMsg: 删除失败的错误信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::DeleteStock(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const std::set<uint64_t >& setFStockSysNo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::map<uint64_t,uint32_t >& mapErrorCode,
				std::map<uint64_t,std::string >& mapErrorMsg,
				std::string& strOutReserve
	)
{
	uint32_t iRetCode = 0;
	//TODO:业务代码
	m_strMachineKey=strMachineKey;
	m_strSource=strSource;
	m_dwSceneId=dwSceneId;
	m_dwOperatorUin=rCntlInfo.getOperatorUin();


    C2C_WW_LOG("UpdateStock %s OpUin:%u MachineKey:%s Source:%s SceneId:%u", __FUNCTION__,
    		m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId);
    //打印性能日志的同时进行接口的itil上报

    iRetCode=CheckCommPara();
	if(iRetCode!=0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}


	CStorageDaoStub4App oStub;
	erp::storage::ddo::CStockDdo oStockddo;
	erp::storage::ddo::CStockDdo oStockddoBack;
	erp::storage::ddo::CStockFilterDdo oStockFilterDdo;
	std::map<uint32_t,erp::storage::ddo::CStockDdo>  mapStocksDdo;
	std::set<uint32_t> idList;

	/*
	CStockPoConvCStockDdo::Conv_CStockPo_To_CStockDdo(oStockInfo,oStockddo);
	*/

	iRetCode=oStub.DeleteStock(rCntlInfo,m_strMachineKey,m_strSource,m_dwSceneId,dwOption,setFStockSysNo,
			strInReserve,strErrmsg,mapErrorCode,mapErrorMsg,strOutReserve);



	if(iRetCode!=0)
	{

		C2C_WW_LOG_ERR(iRetCode,"DeleteStock Failed!   SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
				m_dwSceneId,m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId,strErrmsg.c_str());
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}
}


/**
 *
 *  修改仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param StockPo StockInfo: 仓库信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::UpdateStock(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::po::CStockPo& oStockInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	uint32_t iRetCode = 0;
	//TODO:业务代码
	m_strMachineKey=strMachineKey;
	m_strSource=strSource;
	m_dwSceneId=dwSceneId;
	m_dwOperatorUin=rCntlInfo.getOperatorUin();


    C2C_WW_LOG("UpdateStock %s OpUin:%u MachineKey:%s Source:%s SceneId:%u", __FUNCTION__,
    		m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId);
    //打印性能日志的同时进行接口的itil上报

    iRetCode=CheckCommPara();
	if(iRetCode!=0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	iRetCode=CheckStockInfo(oStockInfo);
	if(iRetCode!=0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	CStorageDaoStub4App oStub;
	erp::storage::ddo::CStockDdo oStockddo;
	erp::storage::ddo::CStockDdo oStockddoBack;
	erp::storage::ddo::CStockFilterDdo oStockFilterDdo;
	std::set<uint32_t> idList;

	CStockPoConvCStockDdo::Conv_CStockPo_To_CStockDdo(oStockInfo,oStockddo);

	iRetCode=oStub.UpdateStock(rCntlInfo,m_strMachineKey,m_strSource,m_dwSceneId,dwOption,oStockddo,
			strInReserve,strErrmsg,strOutReserve);

	if(iRetCode!=0)
	{
		C2C_WW_LOG_ERR(iRetCode,"UpdateStock Failed! ID:%ld SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
				oStockInfo.GetStockSysNo(),m_dwSceneId,m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId,strErrmsg.c_str());
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	return iRetCode;
}

/**
 *
 *  根据ID获取仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set IDList: 需获取的仓库sysnos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector StockList: 仓库列表信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::GetStockBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const std::set<uint64_t >& setIDList,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::vector<erp::storage::po::CStockPo >& vecStockList,
				std::string& strOutReserve
	)
{
	uint32_t iRetCode = 0;
	//TODO:业务代码
	m_strMachineKey=strMachineKey;
	m_strSource=strSource;
	m_dwSceneId=dwSceneId;
	m_dwOperatorUin=rCntlInfo.getOperatorUin();


    C2C_WW_LOG("GetStockBySysNos %s OpUin:%u MachineKey:%s Source:%s SceneId:%u", __FUNCTION__,
    		m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId);
    //打印性能日志的同时进行接口的itil上报

    iRetCode=CheckCommPara();
	if(iRetCode!=0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}




	CStorageDaoStub4App oStub;
	erp::storage::ddo::CStockDdo oStockddo;
	std::vector<erp::storage::ddo::CStockDdo > vecStockDdoList;


	iRetCode=oStub.GetStockBySysNos(rCntlInfo,m_strMachineKey,m_strSource,m_dwSceneId,setIDList,
			strInReserve,strErrmsg,vecStockDdoList,strOutReserve);

	if(iRetCode!=0)
	{
		C2C_WW_LOG_ERR(iRetCode,"GetStockBySysNos Failed! ID SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
				m_dwSceneId,m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId,strErrmsg.c_str());
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}


    std::vector<erp::storage::ddo::CStockDdo>::const_iterator it = vecStockDdoList.begin();
    for (; it != vecStockDdoList.end(); it++)
    {
    	erp::storage::po::CStockPo StockPoInfo;
    	CStockPoConvCStockDdo::Conv_CStockDdo_To_CStockPo((*it), StockPoInfo);
    	vecStockList.push_back(StockPoInfo);
    }


	return iRetCode;
}

/**
 *
 *  根据filter获取仓库信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param StockFilterPo StockFilter: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint32_t total: 仓库总数 	[out]
 *@param Vector StockList: 仓库列表信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::GetStockList(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const erp::storage::po::CStockFilterPo& oStockFilter,
				const std::string& strInReserve,
				std::string& strErrmsg,
				uint32_t& dwTotal,
				std::vector<erp::storage::po::CStockPo >& vecStockList,
				std::string& strOutReserve
	)
{
	uint32_t iRetCode = 0;
	//TODO:业务代码
	m_strMachineKey=strMachineKey;
	m_strSource=strSource;
	m_dwSceneId=dwSceneId;
	m_dwOperatorUin=rCntlInfo.getOperatorUin();


    C2C_WW_LOG("GetStockList %s OpUin:%u MachineKey:%s Source:%s SceneId:%u", __FUNCTION__,
    		m_dwOperatorUin, strMachineKey.c_str(), strSource.c_str(), dwSceneId);
    //打印性能日志的同时进行接口的itil上报

    iRetCode=CheckCommPara();
	if(iRetCode!=0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

    iRetCode=CheckStockFilter(oStockFilter);
    if(iRetCode!=0)
    {
    	C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
    	return iRetCode;
    }



	CStorageDaoStub4App oStub;
	erp::storage::ddo::CStockDdo oStockddo;
	erp::storage::ddo::CStockFilterDdo oStockFilterddo;
	std::vector<erp::storage::ddo::CStockDdo > vecStockDdoList;

	CStockFilterPoConvCStockFilterDdo::Conv_CStockFilterPo_To_CStockFilterDdo(oStockFilter, oStockFilterddo);

	iRetCode=oStub.GetStockList(rCntlInfo,m_strMachineKey,m_strSource,m_dwSceneId,oStockFilterddo,
			strInReserve,strErrmsg,dwTotal,vecStockDdoList,strOutReserve);

	if(iRetCode!=0)
	{
		C2C_WW_LOG_ERR(iRetCode,"GetStockList Failed! ID SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
				m_dwSceneId,m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId,strErrmsg.c_str());
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}


    std::vector<erp::storage::ddo::CStockDdo>::const_iterator it = vecStockDdoList.begin();
    for (; it != vecStockDdoList.end(); it++)
    {
    	erp::storage::po::CStockPo StockPoInfo;
    	CStockPoConvCStockDdo::Conv_CStockDdo_To_CStockPo((*it), StockPoInfo);
    	vecStockList.push_back(StockPoInfo);
    }


	return iRetCode;
}
/**
 *
 *  维护仓库与分支机构关系
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param uint64_t StockSysNo: 仓库sys，必填   [in]
 *@param Set BranchSysNos: 仓库sys，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::ModifyStockBranch_Rel(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				uint64_t ddwStockSysNo,
				const std::set<uint64_t >& setBranchSysNos,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  查询仓库与分支机构关系
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param uint64_t StockSysNo: 仓库sys，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param Vector StockBranchList: 仓库与分支机构关系列表信息 	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::GetStockBranch_RelBySysNo(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				uint64_t ddwStockSysNo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				std::vector<erp::storage::po::CStockBranch_RelPo >& vecStockBranchList
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  写入报损/报溢表
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param LoseBillPo LoseBillInfo: 报损表信息，必填   [in]
 *@param OverFlowBillPo OverFlowBillInfo: 报溢表信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param uint64_t OverFlowBillSysNo: 返回添加成功的SysNo  	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::AddLoseBillOrOverFlowBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::po::CLoseBillPo& oLoseBillInfo,
				const erp::storage::po::COverFlowBillPo& oOverFlowBillInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				uint64_t& ddwOverFlowBillSysNo
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  逻辑删除报损/报溢表
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param Set FLoseBillSysNo: 需删除的报损ID，必填   [in]
 *@param Set FOverFlowBillSysNo: 需删除的报溢ID，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map errorCode: 删除失败的错误码 	[out]
 *@param Map errorMsg: 删除失败的错误信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::DeleteLoseBillOrOverFlowBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const std::set<uint64_t >& setFLoseBillSysNo,
				const std::set<uint64_t >& setFOverFlowBillSysNo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::map<uint64_t,uint32_t >& mapErrorCode,
				std::map<uint64_t,std::string >& mapErrorMsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  修改报损/报溢表
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param LoseBillPo LoseBillInfo: 报损表信息，必填   [in]
 *@param OverFlowBillPo OverFlowBillInfo: 报溢表信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::UpdataLoseBillOrOverFlowBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::po::CLoseBillPo& oLoseBillInfo,
				const erp::storage::po::COverFlowBillPo& oOverFlowBillInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  根据ID获取报损/报溢表信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set LoseBillSysNoList: 需获取的仓库sysnos，必填   [in]
 *@param Set OverFlowSysNoList: 需获取的仓库sysnos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector LoseBillList: 报损列表信息 	[out]
 *@param Vector OverFlowList: 报溢列表信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::GetLoseBillOrOverFlowBillBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const std::set<uint64_t >& setLoseBillSysNoList,
				const std::set<uint64_t >& setOverFlowSysNoList,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::vector<erp::storage::po::CLoseBillPo >& vecLoseBillList,
				std::vector<erp::storage::po::COverFlowBillPo >& vecOverFlowList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  根据filter获取报损/报溢表
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param OverFlowBillOrLoseBillFilterPo OverFlowBillOrLoseBillFilter: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint32_t total: 信息总数 	[out]
 *@param Vector LoseBillList: 报损列表信息 	[out]
 *@param Vector OverFlowList: 报溢列表信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::GetLoseBillOrOverFlowBillList(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const erp::storage::po::COverFlowBillOrLoseBillFilterPo& oOverFlowBillOrLoseBillFilter,
				const std::string& strInReserve,
				std::string& strErrmsg,
				uint32_t& dwTotal,
				std::vector<erp::storage::po::CLoseBillPo >& vecLoseBillList,
				std::vector<erp::storage::po::COverFlowBillPo >& vecOverFlowList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单创建
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param DisassembleBillPo DisassembleBillInfo: 拆装单信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param uint64_t DisassembleBillSysNo: 返回添加成功的SysNo  	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::AddDisassembleBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::po::CDisassembleBillPo& oDisassembleBillInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				uint64_t& ddwDisassembleBillSysNo
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单删除（逻辑）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param Set DisassemblebillSysNos: 需删除的拆装单SysNos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map errorCode: 删除失败的错误码 	[out]
 *@param Map errorMsg: 删除失败的错误信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::DeleteDisassembleBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const std::set<uint64_t >& setDisassemblebillSysNos,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::map<uint64_t,uint32_t >& mapErrorCode,
				std::map<uint64_t,std::string >& mapErrorMsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单修改
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param DisassembleBillPo DisassembleBillInfo: 拆装单信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::UpdataDisassembleBill(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::po::CDisassembleBillPo& oDisassembleBillInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单查询（主键）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set DisassembleBillSysnoList: 需获取的仓库sysnos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector DisassembleBillList: 拆装单信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::GetDisassembleBillBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const std::set<uint64_t >& setDisassembleBillSysnoList,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::vector<erp::storage::po::CDisassembleBillPo >& vecDisassembleBillList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  拆装单列表（列表过滤）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param DisassembleBillFilterPo DisassembleBillFilter: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint32_t total: 信息总数 	[out]
 *@param Vector DisassembleBillList: 拆装单信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::GetDisassembleBillList(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const erp::storage::po::CDisassembleBillFilterPo& oDisassembleBillFilter,
				const std::string& strInReserve,
				std::string& strErrmsg,
				uint32_t& dwTotal,
				std::vector<erp::storage::po::CDisassembleBillPo >& vecDisassembleBillList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  盘点单创建
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param StockCheckMasterPo StockCheckMasterInfo: 盘点单信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *@param uint64_t StockCheckMasterSysNo: 返回添加成功的SysNo  	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::AddStockCheck(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::po::CStockCheckMasterPo& oStockCheckMasterInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve,
				uint64_t& ddwStockCheckMasterSysNo
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  盘点单删除（逻辑）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param Set StockCheckMasterSysNos: 需删除的拆装单SysNos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map errorCode: 删除失败的错误码 	[out]
 *@param Map errorMsg: 删除失败的错误信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::DeleteStockCheck(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const std::set<uint64_t >& setStockCheckMasterSysNos,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::map<uint64_t,uint32_t >& mapErrorCode,
				std::map<uint64_t,std::string >& mapErrorMsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  盘点单修改
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint32_t option: 功能选项，扩展选填   [in]
 *@param StockCheckMasterPo StockCheckMasterInfo: 盘点单信息，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::UpdataStockCheck(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				uint32_t dwOption,
				const erp::storage::po::CStockCheckMasterPo& oStockCheckMasterInfo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 *  盘点单查询（主键）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set StockCheckMasterSysNoList: 需获取的仓库sysnos，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector StockCheckList: 盘点单信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::GetStockCheckBySysNos(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const std::set<uint64_t >& setStockCheckMasterSysNoList,
				const std::string& strInReserve,
				std::string& strErrmsg,
				std::vector<erp::storage::po::CStockCheckMasterPo >& vecStockCheckList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}

/**
 *
 * 盘点单列表（列表过滤）
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param StockCheckFilterPo StockCheckFilterPo: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint32_t total: 信息总数 	[out]
 *@param Vector StockCheckList: 盘点单信息 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CStorageAo::GetStockCheckList(
				const CCntlInfo& rCntlInfo,
				const std::string& strMachineKey,
				const std::string& strSource,
				uint32_t dwSceneId,
				const erp::storage::po::CStockCheckFilterPo& oStockCheckFilterPo,
				const std::string& strInReserve,
				std::string& strErrmsg,
				uint32_t& dwTotal,
				std::vector<erp::storage::po::CStockCheckMasterPo >& vecStockCheckList,
				std::string& strOutReserve
	)
{
	uint32_t dwRet = 0;
	//TODO:业务代码
	
	return dwRet;
}
